<div class="page_head">
<span>
     <%=link_to("Edit".t,edit_project_message_path(@message.project.id,@message),:class=>'admin') if @cur_user.id == @message.user.id or (@project.use_permission and (@cur_user.have_power?(@project) or @cur_user.has_permission?("prj_" + @project.id.to_s + "_" + (@message.category_id.to_i > 0 ? @message.category_id.to_s : "unc") + "_msg_cat_edit")))%> 
   <%=link_to image_tag("trash.gif",:border=>0),project_message_path(params[:project_id],@message),:confirm=>'Are you sure?',:method=>'delete',:class=>'admin' if @cur_user.have_power?(@project) or @message.user_id == @cur_user.id%>
</span>
<h2>
  <%=h @message.name %>
</h2>
</div>

<div class='msg_prop'>
  <%="by ".t%> <%=h @message.user.name%>
  <%="in ".t + link_to(@message.category.name,project_msg_in_category_path(@project.id,@message.category.id)) if @message.category%>
  <%="on ".t + @message.created_at.strftime(LONGDATE)%>
</div>

<div class='msg_body'>
<%=CGI.unescapeHTML(@message.body)%>
</div>

<% if @message.files.size > 0 %>
<div class=extra>
<%@message.files.each do |f|%>
  <%=icon f.content_type%>
  <%=link_to "<strong>" + f.name + "</strong>(" + f.content_type + ")" + number_to_human_size(f.size),project_file_path(f.project,f)%> 
  <%="in".t%> 
  <%=link_to f.category.name,project_file_in_category_path(@project.id,f.category.id) rescue link_to "uncategorized".t,project_file_in_category_path(@project.id,'uncat')%><br/>
<%end%>
</div>
<%end%>

<!--list comments-->
<div id='comments_list'>
  <%=render :partial=>'comments/list',:locals=>{:comments=>@message.comments}%>
</div>

<hr class=dashed>
<strong><%="Leave your comment...".t%></strong>
<!--add comment form-->
<%form_remote_for :comment,:url=>{:controller=>'comments',:action=>'create'} do |f|%>
  <%=f.text_area :body,:rows=>5,:cols=>"100%"%>
  <%=f.hidden_field :user_id,:value=>@cur_user.id%>
  <%=f.hidden_field :message_id,:value=>@message.id%>
  <div>
  <%=indicator('cm')%>
  <%=submit_tag "Post this comment".t,:id=>'sub_cm',:onclick=>"Element.show('indicator_cm');"%>
  </div>
<%end%>



